<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>${title}</title>
		<link href="../css/mngMain.css" type="text/css" rel="stylesheet" />

		<script type="text/javascript" src="../js/jquery.js"></script>
		<script type="text/javascript">
    $(function(){
          $("#selectAllBox").click(function(){            
      			 $("input[@type=checkbox]",$("#topic_table")).each(function(){ 
                      $(this).attr({checked:true});                     
                 });
                 return false;
		  }); //end of allCheck
                   
          $("#deSelectAllBox").click(function(){
      			 $("input[@type=checkbox]",$("#topic_table")).each(function(){ 
                      if(this.checked)
                      {
                          $(this).attr({checked:false});
                      }
                      else
                      {
                      	   $(this).attr({checked:true});
                      }              
                 });
                 return false;
		  }); 
		  
		  $("#delSelected").click(function(){
		         var someSelectd = false;
      			 $("input[@type=checkbox]",$("#topic_table")).each(function(){ 
                      if(this.checked)
                      {
                          someSelectd=true;
                      }             
                 });
                 if(someSelectd)
                 {
                 	if (confirm('你确认要删吗？')) document.getElementById('topicListForm').submit();
                 }
                 else
                 {
                 	alert('您未选定任何行!');
                 }
                 return false;
		  }); 
	});	  
</script>
	</head>

	<body>
		<div class="controlBox">
			<%@include file="../admin_top.jsp"%>
			<div class="mngMain">
				<div class="mngLeft">
					<%@include file="../admin_menu.jsp"%>
				</div>
				<div class="mngRight">
					<div class="mngRightContainer">
						<div class="mngRightContainerT">
							${title}
						</div>
						<div class="mngRightContainerM">
							<logic:notEqual name="parId" value="0" ><div style="float:right"><select onchange="window.location.href('manageCategory.do?parId='+this.value)"><logic:notEmpty name="planList"><logic:iterate id="plan" name="planList"><option value="${plan.categoryId}" <logic:equal name="plan" property="categoryId" value="${parId}" >selected="selected"</logic:equal>>${plan.categoryName}</option></logic:iterate></logic:notEmpty></select></div></logic:notEqual>
							<div>
								<form id="topicListForm" action="deleteCategory.do">
									<input type="hidden" name="parId" value="<%=request.getParameter("parId") %>" />
									<table class="editUser" id="topic_table" cellpadding="0"
										cellspacing="1">										
											<logic:equal name="parId" value="0" >
												<tr>
													<th width="5%"></th>
													<th width="25%">
														计划名称
													</th>
													<th width="20%">
														值班电话
													</th>
													<th width="30%">
														子类操作
													</th>
													<th width="20%">
														操作
													</th>
												</tr>
											</logic:equal>										
											<logic:notEqual name="parId" value="0" >
												<tr>
													<th width="5%"></th>
													<th width="35%">
														子类名称
													</th>
													<th width="30%">
														值班电话
													</th>
													<th width="30%">
														操作
													</th>
												</tr>
											</logic:notEqual>										

										<logic:notEmpty name="cateList">
											<logic:iterate id="cateInfo" name="cateList">
												<tr>
														<td>
															<input type="checkbox" name="delId"
																value="${cateInfo.categoryId }" />
														</td>
														<td class="name">
														<a
																href="preEditCategory.do?id=${cateInfo.categoryId }&parId=<%=request.getParameter("parId") %>"><bean:write
																	name='cateInfo' property='categoryName' /></a>
							
														</td>
														<td class="name">
															<bean:write
																	name='cateInfo' property='phoneNumber' /> 
														</td>
														<logic:equal name="parId" value="0" >						
														<td class="name">
																<a
																	href="manageCategory.do?parId=${cateInfo.categoryId }">[管理本计划子类]</a>
																
																<a
																	href="preAddNewPlan.do?parId=${cateInfo.categoryId }">[添加本计划子类]</a>
															</td>
														</logic:equal>

													<td>
															<a
																href="deleteCategory.do?delId=${cateInfo.categoryId }&parId=<%=request.getParameter("parId") %>"
																onclick="return confirm('你确认要删除吗？')">删除</a>
															<a
																href="preEditCategory.do?id=${cateInfo.categoryId }&parId=<%=request.getParameter("parId") %>">编辑</a>
													</td>
												</tr>
											</logic:iterate>
										</logic:notEmpty>
									</table>
								</form>
								<table class="changePage" cellspacing="1">
									<tr>
										<td>
											<a href="null#" id="selectAllBox">全选</a><a href="null#"
												id="deSelectAllBox">反选</a><a href="#" id="delSelected">删除选中</a>
														
											<logic:notEqual name="parId" value="0" ><a href="preAddNewPlan.do?parId=<%=request.getParameter("parId") %>">添加新子类</a></logic:notEqual>
										</td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="mngBottom">
				<div class="mngLine"></div>
			</div>
		</div>
	</body>
</html>
